package com.atguigu.gulimall.ware.service;

import com.atguigu.common.to.mq.StockLockTo;
import com.atguigu.gulimall.ware.entity.PurchaseDetailEntity;
import com.atguigu.common.to.HasStockTo;
import com.atguigu.common.to.mq.OrderTo;
import com.atguigu.gulimall.ware.vo.WareSkuLockVo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.ware.entity.WareSkuEntity;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author YuGuoJian
 * @email yu925074596@163.com
 * @date 2021-11-22 23:35:38
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    void addStock(List<PurchaseDetailEntity> collect);

    List<HasStockTo> getSkuStock(List<Long> skuIds);

    Boolean orderLock(WareSkuLockVo vo);

    void handleStockLockedRelease(StockLockTo to, Message message, Channel channel) throws IOException;

    void handleOrderCloseRelease(OrderTo to, Message message, Channel channel);
}

